package com.qf.web.controller;/**
 * @author Administrator
 * @version v1.0
 * @date 2022/4/19
 */

import com.alibaba.fastjson.JSON;
import com.qf.domain.GoodsType;
import com.qf.service.GoodsTypeService;
import com.qf.service.impl.GoodsTypeServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * projectName:Project_2202
 * author:
 * time:2022/4/19 19:31
 * description:
 */
@WebServlet("/goodstypeservlet")
public class GoodsTypeServlet extends BaseServlet {
    GoodsTypeService goodsTypeService = new GoodsTypeServiceImpl();
    public void goodstypelist(HttpServletRequest request, HttpServletResponse response)throws IOException{
        List<GoodsType> goodsTypes= goodsTypeService.findTypeListByLevel(1);
        Object json = JSON.toJSON(goodsTypes);
        response.setCharacterEncoding("utf-8");
        response.getWriter().print(json);
    }
}